home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / AExamples / Instructions < prev    next >
Encoding:
Text File  |  1998-12-03  |  5.7 KB  |  153 lines  |  [TEXT/MPS ]

  1. Instructions - The Assembly Language Examples
  2.  
  3. Copyright Apple Computer, Inc. 1987-1990
  4. All rights reserved.
  5.  
  6.  
  7. About the Examples
  8.  
  9.     Three sample assembly language programs are included with MPW:
  10.     an application, a tool, and a desk accessory:
  11.     
  12.         Sample   - a simple MultiFinder-Aware Sample application
  13.         Count        - an MPW tool
  14.         Memory     - a sample desk accessory
  15.  
  16.     The source files for each of these examples are in the
  17.     "Examples:AExamples:" folder.  In addition, a makefiles
  18.     that contains the commands needed to build each of the
  19.     examples is provided in the same folder.
  20.     
  21.  
  22. Building the Examples
  23.  
  24.     You can easily build each of the sample programs using the Directory
  25.     and Build menus.  (See Chapter 2 of the MPW Reference.)
  26.     
  27.     Set the default directory to "AExamples:"
  28.  
  29.         The simplest way to do this is to select from the Directory menu
  30.         the menu item that ends in "AExamples:".  You can also set the
  31.         default directory by using the Directory and SetDirectory commands.
  32.         
  33.  
  34.     Build the program
  35.     
  36.         You can use any of the four Build items at the bottom of the Build
  37.         menu to build the program you have selected.  Each of these menu
  38.         items displays a dialog box that asks for the name of the program
  39.         you want to build.  When this dialog box appears, type the name of
  40.         one of the sample programs (Sample, Count, or Memory).
  41.         
  42.         Each of the Build menu items behaves slightly differently:
  43.         
  44.             Build…  -  The program is automatically built.  The commands
  45.             used, and any error messages, are displayed in the Worksheet.
  46.             Only files that have been changed since you last built the
  47.             program are compiled, saving considerable time.
  48.     
  49.             Full Build…  -  The program is completely rebuilt, ignoring
  50.             any object files or intermediate files that may already exist
  51.             from a previous build.  The commands used, and any errors, are
  52.             displayed in the Worksheet.
  53.             
  54.             Show Build Commands…  -  The commands needed to build the program
  55.             are written to the Worksheet, but not executed.  You can then
  56.             select any or all of the commands and execute them yourself.
  57.             (To execute the commands select them and press Enter.)
  58.             
  59.             Show Full Build Commands…  -  The commands needed to completely
  60.             rebuild the program are written to the Worksheet.  This is a
  61.             convenient way to see all of the commands used in building
  62.             the program you have selected.
  63.  
  64.  
  65.    Note: For more information about building the sample programs, see
  66.    Chapter 2 of the MPW Reference.
  67.  
  68.  
  69.  
  70. Sample - A Simple MultiFinder-Aware Sample Application
  71.  
  72.     Sample is an example application that demonstrates how to initialize
  73.     the commonly used toolbox managers, operate successfully under 
  74.     MultiFinder, handle desk accessories and create windows.
  75.     The source for Sample provides an excellent framework for basing 
  76.     new applications. The source is contained in the files Sample.a
  77.     and SampleMisc.a and Sample.inc1.a, resource descriptions are
  78.     contained in the files Sample.h and Sample.r. The make dependency
  79.     file is named Sample.make.
  80.  
  81.    To build Sample, simply select the line below and press Enter.
  82.  
  83.         BuildProgram Sample ∑∑ "{Worksheet}"
  84.  
  85.    To execute Sample, select the line below and press Enter.
  86.  
  87.         Sample
  88.  
  89.  
  90.  
  91. Count - A Sample MPW Tool
  92.  
  93.     Count, a tool that runs in the MPW environment, counts characters and
  94.     lines in files.  A version of Count is included with MPW, and is
  95.     documented in the MPW Reference, Part II.  The source for Count is in
  96.     the files Count.a, FStubs.a, and Count.r.  MakeFile contains the
  97.     commands for building Count.
  98.  
  99.    To build Count, simply select the line below and press Enter.
  100.  
  101.         BuildProgram Count ∑∑ "{Worksheet}"
  102.  
  103.    To test Count, try counting the characters in file Count.a.
  104.  
  105.       Count -c Count.a ∑∑ "{Worksheet}"
  106.  
  107.  
  108. Memory - A Sample Desk Accessory
  109.  
  110.  
  111.    Memory is a sample desk accessory written in assembly language.  It
  112.    displays the memory available in the application and system heaps,
  113.    and on the boot disk.  MakeFile contains the commands for building
  114.    Memory.
  115.  
  116.    To build Memory, simply select the line below and press Enter.
  117.  
  118.         BuildProgram Memory ∑∑ "{Worksheet}"
  119.  
  120.    The build process creates a duplicate line which will copy
  121.    the Memory DA to your Apple Menu Items folder.
  122.  
  123. Writing Your Own Programs
  124.  
  125.     After building (and perhaps modifying) the sample programs, you will
  126.     undoubtedly want to write a program of your own.  Use the New… item in
  127.     the File menu, to create the source files.  Remember that assembly
  128.     language source filenames should end in .a.
  129.     
  130.     Create Build Commands…  -  The Create Build Commands… item in the 
  131.     Build menu runs a script that creates a makefile containing the
  132.     commands for building programs written in C, Assembly Language, Pascal, 
  133.     and/or Rez.  Selecting Create Build Commands… displays a dialog box that 
  134.     allows you to enter information about your program.  Type the program's
  135.     name, select its source files by clicking the Files… button, and click
  136.     one of the radio buttons to indicate your choice of an application, tool,
  137.     or desk accessory.  
  138.     
  139.     Create Build Commands… puts the makefile for your program in the file
  140.     <program>.make.  Now you can use the Build menu to build and rebuild
  141.     your program, just as with the examples.
  142.     
  143.     Larger Programs  -  If you add source files as your program grows,
  144.     use Create Build Commands… again to add the new source files to the build
  145.     instructions.  If you out-grow the capabilities of the simple Create
  146.     Build Commands… script (perhaps by using tools other than Asm, C, Pascal,
  147.     Rez, and Link in your builds) you can modify the makefile yourself.
  148.     
  149.     Modifying the Directory and Build Menus  -  The Directory and Build
  150.     menus are both implemented using scripts written in the MPW Shell
  151.     command language.  This has the big advantage that you can modify
  152.     or customize them to match the way you work.
  153.